#pragma once

#define N_LEN 32
#define DATAFILE_OPEN_FAIL	0
#define DATAFILE_OPEN_SUCCESS	1
#define LINE_MAX	512

class Detail
{
public:
	Detail(void);
	~Detail(void);

private:
	enum DETAIL_IDS{
		DETAIL_ID_SAMPLE_NO,
		DETAIL_ID_CUSTOMER,
		DETAIL_ID_MANUFACTURE_NO,
		DETAIL_ID_MANUFACTURE_PROCESS,
		DETAIL_ID_LOT_NO,
		DETAIL_ID_MATERIAL_NO,
		DETAIL_ID_MATERIAL_NAME,
		DETAIL_ID_SPECIFICATION,
		DETAIL_ID_FINAL_JUDGE, //judege for the sample, may lots of test items
		DETAIL_ID_TEST_ITEM,
		DETAIL_ID_TEST_RESULT,
		DETAIL_ID_THIS_JUDGE, //judege for this item
		DETAIL_ID_TESTER,
		DETAIL_ID_APPLIED_TIME,
		DETAIL_ID_TEST_TIME,
		DETAIL_ID_TEST_STATE,
		DETAIL_ID_STANDARD_FIELD,
		DETAIL_ID_STANDARD_HIGH,
		DETAIL_ID_STANDARD_LOW,
		DETAIL_ID_APPLICANT,
		DETAIL_ID_SAMPLE_COUNT,
		DETAIL_ID_RECEIVER,
		DETAIL_ID_SAMPLE_DISCRIPTION,
		DETAIL_ID_RESULT_REMARK,
		DETAIL_ID_APPLICANT_REMARK,
		DETAIL_ID_IS_URGENT,
		DETAIL_ID_UNIT_PRICE,
	};

#define DETAIL_ID_MAX DETAIL_ID_UNIT_PRICE

	string sample_no;
	string customer;
	string manufacture_no;
	string manufacture_process;
	string lot_no;
	string material_no;
	string material_name;
	string specification;
	string final_judge;
	string test_item;
	string test_result;
	string this_judge;
	string tester;
	string applied_time;
	string test_time;
	string test_state;
	string standard_field;
	string standard_high;
	string standard_low;
	string applicant;
	string test_count;
	string receiver;
	string sample_description;
	string result_remark;
	string applicant_remark;
	string is_urgent;
	string unit_price;

	string detail_id_error;

public:
	int lineToDetail(string &line);
	//int detailToLine(string &line);
	string & getApplicant(void);
	string & getMetarial(void);
	string & getTestItem(void);
	bool isQualified(void);
	string & getSmpNo(void);
	string & getCustomer(void);
	string & getMaterialNo(void);
	bool isMinorElement(void);
	string & getSpec(void);
	string & getLotNumber(void);
	string & getAppliedTime(void);
	string & getTestResult(void);
	string & getApplicantRemark(void);
	bool isUrgent(void);
	int getUnitPrice(void);
	string & GetDetailStringByID(int id);
};

